-
Notifications
You must be signed in to change notification settings - Fork 24
Write CRT data asynchronously #319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This is also blocking on the protocol test skips that are in #318 |
99323d2 to
a0f8991
Compare
This updates the CRT bindings to write data to its ByteIO body asynchronously rather than buffering it all into memory when making a call. This should enable us to support event streaming, and also prevent us from buffering a huge amount of data into memory, even for synchronous bodies of uncertain size.
a0f8991 to
b210f52
Compare
| # Should we call close here? Or will that make the crt unable to read the last | ||
| # chunk? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we tested this at all? My initial impression is we'd throw a ValueError in the CRT trying to read from a closed object. I would think this gets cleaned up for us automatically once it goes out of scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that it's hard to test the CRT without a live connection. If nothing else, the BytesIO will eventually get garbage collected since when this task complete there'll be no more references to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a mark this with a TODO so we know to come back eventually? Otherwise, that seems fine.
Fix comment typos Co-authored-by: Nate Prewitt <[email protected]>
This updates the CRT bindings to write data to its ByteIO body asynchronously rather than buffering it all into memory when making a call. This should enable us to support event streaming, and also prevent us from buffering a huge amount of data into memory, even for synchronous bodies of uncertain size.
This should also allow us to get rid of those consume_body utility functions that I detest. But one thing at a time.
Also, we really need to work on standing up a local http2 server for testing. Integ tests will be nice too and all but I'm nevertheless nervous about how hard this is to test.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.